package com.spzx.channel.Contoller;

import com.spzx.channel.service.ICategoryService;
import com.spzx.common.core.web.controller.BaseController;
import com.spzx.common.core.web.domain.AjaxResult;
import com.spzx.product.api.domain.vo.CategoryVo;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.ServletException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * projectName: spzx-parent
 *
 * @author: 王宝贵
 * time: 2024/10/8 21:00 周二
 * description: 用户分类查询
 */
@Slf4j
@RestController
@RequestMapping("/category")
@Tag(name = "分类查询")
public class CategoryController extends BaseController {

    @Autowired
    private ICategoryService categoryService;

    /**
     * 用户的分类查询
     * @return 返回集合
     */
    @GetMapping(value = "/tree")
    public AjaxResult tree() throws ServletException {
        List<CategoryVo> categoryVoList= categoryService.tree();
        return success(categoryVoList);
    }

}